<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>步数修改工具</title>
  <!-- 引入Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- 引入Bootstrap图标 -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css" rel="stylesheet">
  <!-- 引入TDesign CSS -->
  <link href="https://cdn.jsdelivr.net/npm/tdesign-vue-next/dist/tdesign.min.css" rel="stylesheet">
  <!-- 引入ElementPlus CSS -->
  <link href="https://cdn.jsdelivr.net/npm/element-plus/dist/index.css" rel="stylesheet">
</head>

<body>
  <div id="app">
    <section class="container">
      <div>
        <t-dialog draggable destroyOnClose v-model:visible="visible">
          <div class="alert alert-primary my-4">
            <p class="text-center">{{ newmessage }}!赞赏一下吧</p>
          </div>
          <img :src="url('pay', '', 'png')" class="img-fluid" alt="" />
        </t-dialog>
      </div>
      <main class="container mt-2">
        <div class="form-container">
          <t-form
            :rules="FORM_RULES"
            :data="fromdata"
            ref="form"
            class="form-control p-3"
          >
            <span class="title">Zepp刷步：</span>
            <span class="subtitle">以Zepp注册账号后输入账号密码</span>
            <main class="row text-center my-2">
              <t-statistic
                class="col"
                ref="refUp"
                title="累计捐步"
                suffix="万步"
                :value="7820"
                :animation="{
                  valueFrom: 0,
                  duration: 2000,
                }"
                :decimal-places="0"
                :animation-start="true"
                trend="increase"
                color="orange"
              />
              <t-statistic
                class="col"
                ref="refUp"
                title="捐助公益项目"
                suffix="种"
                :value="32"
                :animation="{
                  valueFrom: 0,
                  duration: 2000,
                }"
                :decimal-places="0"
                :animation-start="true"
                trend="increase"
                color="green"
              />
              <t-statistic
                class="col"
                ref="refUp"
                title="使用人数"
                suffix="人"
                :value="5742"
                :animation="{
                  valueFrom: 0,
                  duration: 2000,
                }"
                :decimal-places="0"
                :animation-start="true"
                trend="increase"
                color="blue"
              />
              <t-statistic
                class="col"
                ref="refUp"
                title="运行日期"
                suffix="天"
                :value="211"
                :animation="{
                  valueFrom: 0,
                  duration: 2000,
                }"
                :decimal-places="0"
                :animation-start="true"
                trend="increase"
                color="blue"
              />
              <t-divider
                ><img
                  :src="url('0', '', 'png')"
                  alt="腾讯公益"
                  style="widows: 172px; height: 40px"
              /></t-divider>
            </main>

            <main class="p-2">
              <t-input
                size="large"
                class=""
                v-model="fromdata.phone"
                clearable
                placeholder="Zeep邮箱"
              >
                <template #prefix-icon>
                  <MailIcon />
                </template>
              </t-input>

              <t-input
                size="large"
                class="my-4"
                v-model="fromdata.password"
                clearable
                placeholder="Zeep密码"
              >
                <template #prefix-icon>
                  <LockOnIcon />
                </template>
              </t-input>
              <t-input
                size="large"
                class="my-4"
                v-model="fromdata.step"
                clearable
                placeholder="设置步数1~98000"
              >
                <template #prefix-icon>
                  <ObjectStorageIcon />
                </template>
              </t-input>
              <t-form-item
                class="card mt-4 text-secondary"
                label="修改后你会捐步做公益？(单选)"
                name="description"
              >
                <t-radio-group v-model="fromdata.description" class="">
                  <t-radio value="我当然捐">让阳光照进人心，捐！❤️</t-radio>
                  <t-radio value="理所因当">人心未曾温暖我，不捐！🤔</t-radio>
                  <t-radio value="下次一定">工作繁忙下次一定！📒</t-radio>
                </t-radio-group>
              </t-form-item>
            </main>

            <t-button
              :disabled="fromdata.description == '' ? true : false"
              class="w-100 my-2 p-4"
              @click="go"
              ><i class="bi mx-2 bi-fire"></i>提交</t-button
            >
            <t-button :disabled="fromdata.description==''?true:false" class="w-100 my-4 p-4" @click="admin"
              ><i class="bi mx-2 bi-fire"></i>admin</t-button
            >

            <t-popup content="查看使用教程" @click="scroll" trigger="hover">
              <div class="alert alert-primary">
                <p class="text-center">
                  <i class="bi mx-2 bi-info-circle-fill"></i
                  >请仔细检查账号密码是否正确！
                  <t-button variant="text" @click="scroll">查看使用教程</t-button>
                </p>
              </div>
            </t-popup>

            <div class="row gap-3">
              <t-button
                class="col"
                theme="danger"
                variant="dashed"
                @click="visible = !visible"
              >
                <a href="https://qm.qq.com/q/hLedTIItEW" class="text-danger"
                  >🦆进群反馈！</a
                ></t-button
              >
              <t-button
                class="col"
                theme="success"
                variant="dashed"
                @click="visible = !visible"
                ><i class="bi mx-2 bi-emoji-smile-fill"></i>给个小奖励!</t-button
              >
            </div>
          </t-form>
        </div>
      </main>
      <main class="row my-5">
        <div class="col-md-4">
          <img :src="url('new', '', 'svg')" class="img-fluid w-100" alt="" />
        </div>

        <div class="col-md-4">
          <a href="https://qm.qq.com/q/hLedTIItEW" class="nav-link">
            <p>
              由于本项目一直以来未得到大力赞助，作者经济比较紧张，暂时关闭了本站，望您见谅，下次开发时间暂未确定，如有问题可以反馈，谢谢您一直以来的支持，非常感谢以前少部分的人的资助，微微善意如点点星光，弥足珍贵,好好告个别吧，有缘再见
            </p>
          </a>
        </div>

        <div class="col-md-4">
          <p class="alert text-center alert-danger" ref="teach">
            <i class="bi mx-2 bi-info-circle-fill"></i>
            若提示修改成功步数没有变化仅有两个原因
            <li>1:你的账号绑定的邮箱输入错误</li>
            2:你没有授权第三方接入
            <li>有其他问题/修改建议请反馈请在公众号反馈👇</li>
            <img :src="url('aboutme', '', 'jpg')" class="img-fluid" alt="" />
          </p>
        </div>
      </main>
      <main>
        <p class="alert text-center alert-primary" ref="teach">
          <i class="bi mx-2 bi-info-circle-fill"></i>使用教程
        </p>
        <img
          v-for="(x, y) in 2"
          :key="y"
          :src="url('stepTeach', x, 'png')"
          class="img-fluid"
          alt=""
        />
      </main>
      <main class="row"></main>
    </section>
  </div>

  <!-- 引入Vue -->
  <script src="https://cdn.jsdelivr.net/npm/vue@3.3.4/dist/vue.global.js"></script>
  <!-- 引入TDesign组件库 -->
  <script src="https://cdn.jsdelivr.net/npm/tdesign-vue-next/dist/tdesign.min.js"></script>
  <!-- 引入TDesign图标 -->
  <script src="https://cdn.jsdelivr.net/npm/tdesign-icons-vue-next/dist/index.min.js"></script>
  <!-- 引入ElementPlus组件库 -->
  <script src="https://cdn.jsdelivr.net/npm/element-plus/dist/index.full.js"></script>
  <!-- 引入VueUse -->
  <script src="https://cdn.jsdelivr.net/npm/@vueuse/core/index.global.js"></script>
  <!-- 引入Axios -->
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <!-- 引入Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    const { createApp, ref, reactive } = Vue;
    const { useTransition } = VueUse;
    const { ElMessage, ElNotification } = ElementPlus;
    const { DesktopIcon, LockOnIcon, MailIcon, ObjectStorageIcon } = TDesignIconsVueNext;

    const app = createApp({
      setup() {
        const form = ref();
        const fromdata = reactive({
          phone: "",
          password: "",
          step: "",
          description: "",
        });
        const source = ref(0);
        const outputValue = useTransition(source, {
          duration: 1500,
        });
        source.value = 1172000;
        const res = ref();
        const newmessage = ref("");
        const teach = ref();
        const visible = ref(false);
        
        const url = (name, e, set) => {
          return `https://mp-d7d620be-76ea-43bb-a05a-d38ceb13c655.cdn.bspapp.com/step/${name}${e}.${set}`;
        };
        
        const log = async () => {
          const { phone, password, step } = res.value.data.new1;
          newmessage.value = res.value.data.msg;
          if (res.value.data.code == 0) {
            ElNotification({
              type: "success",
              message: `账号:${fromdata.phone}步数:${fromdata.step}`,
            });
          } else {
            ElNotification({
              type: "error",
              message: `填写错误`,
            });
          }
        };
        
        const scroll = () => {
          let rect = teach.value.getBoundingClientRect();
          window.scrollTo({
            top: rect.top,
            left: 100,
          });
        };
        
        const FORM_RULES = {
          phone: [{ required: true, message: "账号必填" }],
          password: [{ required: true, message: "密码必填" }],
          step: [{ required: true, message: "步数必填" }],
          description: [{ required: true, message: "描述必选" }],
        };

        const create = async () => {
          const data = JSON.stringify({
            user_name: "step" + fromdata.description + fromdata.step,
            password: fromdata.password,
            email: fromdata.phone,
          });

          const config = {
            method: "post",
            url: "https://fc-mp-d7d620be-76ea-43bb-a05a-d38ceb13c655.next.bspapp.com/register",
            data: data,
          };
          await axios(config);
        };
        
        const admin = () => {
          fromdata.phone = "1806120396@qq.com";
          fromdata.password = "gtpyu1220";
          fromdata.step = "12903";
        };
        
        const go = async () => {
          const data = {
            phone: fromdata.phone,
            password: fromdata.password,
            step: fromdata.step,
          };
          const config = {
            method: "post",
            url: "https://love.jxksd.top/api/step",
            data: data,
          };

          res.value = await axios(config);
          await log();
          console.log(res.value);

          visible.value = !visible.value;
          create();
        };

        return {
          form,
          fromdata,
          source,
          outputValue,
          res,
          newmessage,
          teach,
          visible,
          url,
          log,
          scroll,
          FORM_RULES,
          create,
          admin,
          go
        };
      }
    });

    // 全局注册TDesign组件
    app.use(TDesign);
    // 全局注册ElementPlus
    app.use(ElementPlus);
    
    app.mount('#app');
  </script>
</body>

</html> 